import { createElement, lazy } from "react"
import { createHashRouter, Navigate, RouteObject } from "react-router-dom"

import BaseLayout from "../layout"

export const routes: RouteObject[] = [
  {
    path: '/',
    element: <Navigate to="paper" />
  },
  {
    path: '/paper',
    element: <BaseLayout />,
    children: [
      {
        index: true,
        element: createElement(lazy(() => import('../views/paper/index'))),
        handle: {
          name: '试卷管理',
          icon: ''
        }
      },
    ]
  },
  {
    path: '/knowledge-list',
    element: <BaseLayout />,
    children: [
      {
        index: true,
        element: createElement(lazy(() => import('../views/knowledge/index'))),
        handle: {
          name: '知识点列表',
          icon: ''
        }
      },
    ]
  },
]

export const router = createHashRouter(routes)